<template>
  <div>
    <el-card shadow="never" class="mb20">
      <plan-form ref="planForm" @search="handleSearch" />
    </el-card>
    <el-card shadow="never">
      <el-tabs v-model="name">
        <el-tab-pane label="未完成" name="first">
          <plan-list :name="name" ref="planList" />
        </el-tab-pane>
        <el-tab-pane label="已完成" name="second">
          <finished-list :name="name" ref="finishedList" />
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
import PlanForm from '../plan/PlanForm'
import PlanList from './planList'
import FinishedList from './FinishedList'
import { notFinishedTask, finishedTask } from '@/api/eval'

export default {
  components: {
    PlanForm,
    PlanList,
    FinishedList
  },
  data() {
    return {
      name: 'first'
    }
  },
  methods: {
    // handleTabClick() {}
    handleSearch(param) {
      if (this.name === 'first') {
        this.$refs.planList.getNotFinished(param)
      } else {
        this.$refs.finishedList.getFinishedTask(param)
      }
    }
  }
}
</script>
